<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div></div>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script>
    axios({
      url: 'http://hmajax.itheima.net/api/news'
    }).then((result) => {
      console.log(result)
      console.log(result.data)
      console.log(result.data.data[0])
      let value = result.data.data
      console.log(value)
      let arr = []
      for (let i = 0; i < 5; i++) {
        console.log(value[i].title)
        arr.push(value[i].title)
      }
      console.log(arr)
      document.querySelector('div').innerHTML = arr.join('<br>')
    })
  </script>
</body>

</html>